home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2001 May / SGI IRIX Base Documentation 2001 May.iso / usr / share / catman / u_man / cat1 / mkstr.z / mkstr
Encoding:
Text File  |  1998-10-20  |  3.6 KB  |  133 lines

  1.  
  2.  
  3.  
  4. MMMMKKKKSSSSTTTTRRRR((((1111))))                                                              MMMMKKKKSSSSTTTTRRRR((((1111))))
  5.  
  6.  
  7.  
  8. NNNNAAAAMMMMEEEE
  9.      mkstr - create an error message file by massaging C source
  10.  
  11. SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  12.      mmmmkkkkssssttttrrrr [ ---- ] messagefile prefix file ...
  13.  
  14. DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  15.      _M_k_s_t_r is used to create files of error messages.  Its use can make
  16.      programs with large numbers of error diagnostics much smaller, and reduce
  17.      system overhead in running the program as the error messages do not have
  18.      to be constantly swapped in and out.
  19.  
  20.      _M_k_s_t_r will process each of the specified _f_i_l_e_s, placing a massaged
  21.      version of the input file in a file whose name consists of the specified
  22.      _p_r_e_f_i_x and the original name.
  23.  
  24.      To process the error messages in the source to the message file _m_k_s_t_r
  25.      keys on the string ````eeeerrrrrrrroooorrrr((((""""'''' in the input stream.  Each time it occurs,
  26.      the C string starting at the """" is placed in the message file followed by
  27.      a new-line character and a null character; the null character terminates
  28.      the message so it can be easily used when retrieved, the new-line
  29.      character makes it possible to sensibly _c_a_t the error message file to see
  30.      its contents.  The massaged copy of the input file then contains an
  31.      _l_s_e_e_k(2) pointer into the file which can be used to retrieve the message,
  32.      i.e.:
  33.  
  34.           cccchhhhaaaarrrr  efilname[] =  "/usr/lib/pi_strings";
  35.           iiiinnnntttt   efil = -1;
  36.  
  37.           error(a1, a2, a3, a4)
  38.           {
  39.                 cccchhhhaaaarrrr buf[256];
  40.  
  41.                 iiiiffff (efil < 0) {
  42.                          efil = open(efilname, 0);
  43.                          iiiiffff (efil < 0) {
  44.           oops:
  45.                                   perror(efilname);
  46.                                   exit(1);
  47.                          }
  48.                 }
  49.                 iiiiffff (lseek(efil, (long) a1, 0) || read(efil, buf, 256) <= 0)
  50.                          ggggoooottttoooo oops;
  51.                 printf(buf, a2, a3, a4);
  52.           }
  53.  
  54.      The optional ---- causes the error messages to be placed at the end of the
  55.      specified message file for recompiling part of a large _m_k_s_t_red program.
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.                                                                         PPPPaaaaggggeeee 1111
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. MMMMKKKKSSSSTTTTRRRR((((1111))))                                                              MMMMKKKKSSSSTTTTRRRR((((1111))))
  71.  
  72.  
  73.  
  74. EXAMPLE
  75.      If the current directory has files "a.c" and "b.c", then
  76.  
  77.           mkstr exs x *.c
  78.  
  79.      would create a new file "exs" which holds all the error messages
  80.      extracted from the source files "a.c" and "b.c", as well as two new
  81.      source files "xa.c" and "xb.c" which no longer contains the extracted
  82.      error messages.
  83.  
  84. SSSSEEEEEEEE AAAALLLLSSSSOOOO
  85.      lseek(2).
  86.  
  87. BBBBUUUUGGGGSSSS
  88.      All the arguments except the name of the file to be processed are
  89.      unnecessary.
  90.  
  91. AAAAUUUUTTTTHHHHOOOORRRRSSSS
  92.      Bill Joy and Charles Haley.
  93.  
  94.  
  95.  
  96.  
  97.  
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.                                                                         PPPPaaaaggggeeee 2222
  130.  
  131.  
  132.  
  133.